package org.zfes.snowier.cloud.zbss.cms.router.service.words;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.words.model.CmsWordsHot;
import org.zfes.snowier.cloud.zbss.cms.words.service.ICmsWordsHotService;
@Controller 
@RequestMapping("/cms/words/cmsWordsHot")
public class CmsWordsHotController extends BaseController {

	
	@Autowired
	private ICmsWordsHotService cmsWordsHotService;
	
	@RequiresPermissions(value="cmsWordsHot:loadCmsWordsHotDataSet",desc="热词列表")
    @RequestMapping(value="/loadCmsWordsHotDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsWordsHotDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsWordsHotService.loadCmsWordsHotDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsWordsHot:createCmsWordsHot",desc="热词添加")
    @RequestMapping(value="/createCmsWordsHot", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsWordsHot(CmsWordsHot cmsWordsHot){
		cmsWordsHotService.createCmsWordsHot(cmsWordsHot);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsWordsHot:loadCmsWordsHot",desc="热词加载")
    @RequestMapping(value="/loadCmsWordsHot", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsWordsHot(Long id){
		Optional<CmsWordsHot> ops = cmsWordsHotService.loadCmsWordsHotById(id);
		return ajaxQuery("cmsWordsHot",ops);
    }
	
	@RequiresPermissions(value="cmsWordsHot:updateCmsWordsHot",desc="热词更新")
    @RequestMapping(value="/updateCmsWordsHot", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsWordsHot(CmsWordsHot cmsWordsHot){
		cmsWordsHotService.updateCmsWordsHot(cmsWordsHot);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsWordsHot:deletCmsWordsHot",desc="热词删除")
    @RequestMapping(value="/deleteCmsWordsHot", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsWordsHot(Long id){
		cmsWordsHotService.deleteCmsWordsHot(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}